package comWorld.action.msg;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import comWorld.msg.Message;
import comWorld.msg.MessageManage;
import comWorld.user.UserStatus;

/**
 * Servlet implementation class DeleteMsg
 */
@WebServlet("/action/msg/deleteMsg")
public class DeleteMsg extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteMsg() {
        super();
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int msgId = Integer.valueOf(request.getParameter("msgId"));
		UserStatus status = (UserStatus) request.getSession().getAttribute("visitorStatus");
		MessageManage.deleteMsg(status.getId(), msgId);
	}

}
